/*
 * FaceCat图形通讯框架
 * 著作权编号:2015SR229355+2020SR0266727
 * 上海卷卷猫信息技术有限公司
 */


#ifdef __FCSTRING_H__ 
#else                                                                            
#define __FCSTRING_H__
#endif

#pragma once
#include "../../stdafx.h"

namespace FaceCat{
    class fcwstring
	{
	public:
		fcwstring();
		fcwstring(const fcwstring& str);
		fcwstring(const wchar_t *str, int len = -1);
		~fcwstring();
		void empty();
		int length() const;
		bool isEmpty() const;
		wchar_t at(int index) const;
		fcwstring append(const wchar_t *str);
		void assign(const wchar_t *str, int len = -1);
		wchar_t* c_str() const;
		void set(int index, wchar_t ch);
		operator wchar_t*() const;
		wchar_t operator[] (int index) const;
		const fcwstring& operator=(const fcwstring& str);
		const fcwstring& operator=(const wchar_t ch);
		const fcwstring& operator=(const wchar_t *str);
		const fcwstring& operator+=(const wchar_t *str);
		fcwstring operator+(const fcwstring& src) const;
		fcwstring operator+(const wchar_t *str) const;
		const fcwstring& operator+=(const fcwstring& str);
		const fcwstring& operator+=(const wchar_t ch);
		bool operator == (const wchar_t *str) const;
		bool operator != (const wchar_t *str) const;
		bool operator <= (const wchar_t *str) const;
		bool operator <  (const wchar_t *str) const;
		bool operator >= (const wchar_t *str) const;
		bool operator >  (const wchar_t *str) const;
		bool operator == (const fcwstring& str) const;
		bool operator != (const fcwstring& str) const;
		bool operator <= (const fcwstring& str) const;
		bool operator <  (const fcwstring& str) const;
		bool operator >= (const fcwstring& str) const;
		bool operator >  (const fcwstring& str) const;
		int compare(const wchar_t *str) const;
		int compare(const fcwstring& str) const;
		fcwstring toUpper();
		fcwstring toLower();
        fcwstring substr(int pos, int len = -1) const;
		int find(const wchar_t *str, int pos = 0) const;
		int rfind(const wchar_t *str, int pos = 0) const;
		int find(const fcwstring& str, int pos = 0) const;
		int rfind(const fcwstring& str, int pos = 0) const;
		int find(wchar_t ch, int pos = 0) const;
		int find_last_of(wchar_t ch, int pos = 0) const;
		int replace(const wchar_t *from, const wchar_t *to);
	protected:
		wchar_t *m_str;
		wchar_t m_buffer[64];
	};

    class fcstring
	{
	public:
		fcstring();
		fcstring(const fcstring& str);
		fcstring(const char *str, int len = -1);
		~fcstring();
		void empty();
		int length() const;
		bool isEmpty() const;
		char at(int index) const;
		fcstring append(const char *str);
		void assign(const char *str, int len = -1);
		char* c_str() const;
		void set(int index, char ch);
		operator char*() const;
		char operator[] (int index) const;
		const fcstring& operator=(const fcstring& str);
		const fcstring& operator=(const char ch);
		const fcstring& operator=(const char *str);
		const fcstring& operator+=(const char *str);
		fcstring operator+(const fcstring& src) const;
		fcstring operator+(const char *str) const;
		const fcstring& operator+=(const fcstring& str);
		const fcstring& operator+=(const char ch);
		bool operator == (const char *str) const;
		bool operator != (const char *str) const;
		bool operator <= (const char *str) const;
		bool operator <  (const char *str) const;
		bool operator >= (const char *str) const;
		bool operator >  (const char *str) const;
		bool operator == (const fcstring& str) const;
		bool operator != (const fcstring& str) const;
		bool operator <= (const fcstring& str) const;
		bool operator <  (const fcstring& str) const;
		bool operator >= (const fcstring& str) const;
		bool operator >  (const fcstring& str) const;
		int compare(const char *str) const;
		int compare(const fcstring& str) const;
		fcstring toUpper();
		fcstring toLower();
		fcstring substr(int pos, int len = -1) const;
		int find(const char *str, int pos = 0) const;
		int rfind(const char *str, int pos = 0) const;
		int find(const fcstring& str, int pos = 0) const;
		int rfind(const fcstring& str, int pos = 0) const;
		int find(char ch, int pos = 0) const;
		int find_last_of(char ch, int pos = 0) const;
		int replace(const char *from, const char *to);
	protected:
		char *m_str;
		char m_buffer[64];
	};
}
